<template>
  <div
    class="fixed"
    right-0
    bottom-0
    flex
    flex-col
    justify-center
    items-center
    w-118px
    h-239px
    z-10
    @click.prevent="backPage"
  >
    <image z-11 absolute w-118px h-239px src="@/static/back_bg.png"></image>
    <image z-12 w-45px h-40px src="@/static/back.png"></image>
    <div z-12 text="#fff" text-27px mt-10px>{{ title }}</div>
  </div>
</template>

<script setup lang="ts">
const title = ref<string>('')
function backPage() {
  uni.navigateBack({
    delta: 1,
    fail: () => {
      uni.reLaunch({
        url: '/pages/index'
      })
    }
  })
}
onMounted(() => {
  const pages = getCurrentPages()
  title.value = pages.length === 2 ? '主页' : '返回'
})
</script>

<style scoped></style>
